package thermologic.onewire;

import thermologic.core.AdapterEvent;

/**
 * Event fired when the OneWireAdapter
 * begins search of one available adapter
 * 
 * @author Mauricio Rivadeneira
 */
public class OneWireAdapterEvent extends AdapterEvent
{
    private String message;
    
    private String code;
    
    public OneWireAdapterEvent(OneWireAdapter owAdapter, String code)
    {
        super(owAdapter);
        this.code = code;
        message = Messages.getMessage(code);
    }
    
    public OneWireAdapterEvent(OneWireAdapter owAdapter,
            EventCode eventCode)
    {
        this(owAdapter, eventCode.getCode());
    }
    
    @Override
    public String getEventMessage()
    {
        return message;
    }
    
    @Override
    public String getEventCode()
    {
        return code;
    }

}
